<%@ include file="/WEB-INF/views/taglib.jsp" %>
 <c:url value="/section/search" var="paginationUrl"></c:url>
 <div>
 <h3 class="left">Section Search</h3>
 <a href="<c:url value="/section/create" />" class="button right">
	<img align="absmiddle" src="${imageUrl}/icon_add.png"> Create Section
</a>
 <a onclick="$('.searchCriteria').toggle();" class="button right">
	<img align="absmiddle" src="${imageUrl}/icon_detail.png"> Toggle Search Criteria
</a>
</div>
<div class="clear"></div>
 <form:form id="form" method="get" modelAttribute="searchCriteria" cssClass="simpleForm">
 <div class="searchCriteria">
 <fieldset>
 	<legend>Search Criteria</legend>
	<p>
	<form:label path="search['sectionCode']" >
	Section Code  
	</form:label> 
	<form:input path="search['sectionCode']"/>
	</p>
	<p>
	<form:label path="search['sectionName']">
	Section Name
	</form:label> 
	<form:input path="search['sectionName']"/>
	</p>
	
</fieldset>
	<span class="right">
	  	<button type="submit" class="button">Search</button>
	 </span>
 </div>
 </form:form>	
 <div class="clear"></div>
 <fieldset>
 	<legend>Search Result</legend>
 	<c:choose>
 		<c:when test="${searchResult.resultCount==0}">
 		<div class="notice">
 		<span class="ui-icon ui-icon-info left marginright5"></span>
 		No records </div>
 		</c:when>
 	<c:otherwise>
 <table class="gridSearch">
 <thead>	
 	<tr>
 		<th>S/N</th>
 		<th>
 		<aims:sort columnName="sectionCode" label="Section Code"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="sectionName" label="Section Name"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="department.departmentName" label="Department"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="modifiedBy" label="Modified By"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="dateModified" label="Modified Date"></aims:sort>
 		</th>
 		<th>
 		Action
 		</th>
 	</tr>
 </thead>
 <tbody>
 	
 	<c:forEach items="${searchResult.result}" var="result" varStatus="status">
 	<tr <c:if test="${(status.count%2)==0 }">class="alt"</c:if>>
 		<td class="seqNo">${searchResult.recordNo+status.index}</td>
 		<td>${result.sectionCode}</td>
 		<td>
 		<c:url value="/section/update" var="editUrl"></c:url>
 		<a href="${editUrl}/${result.sectionId}">
 		${result.sectionName}
 		</a></td>
 		<td>${result.department.departmentName}</td>
 		<td>${result.lastModifiedBy}</td>
 		<td>${result.lastModifiedDate}</td>
 		<td>
 		<c:url value="/section/delete" var="deleteUrl"></c:url>
 		<a href="javascript:void(0)" onclick="confirmDisable('${deleteUrl}/${result.sectionId}')" class="CD_actions">
 		<img align="absmiddle" src="${imageUrl}/icon_delete.png">  Disable</a>
 		</td>
 		</tr>
 	</c:forEach>
 	
 </tbody>
 <tfoot>
 	<tr><td colspan="10" align="right">
 		<jsp:include page="/WEB-INF/views/pagination.jsp">
 			<jsp:param name="paginationUrl" value="${paginationUrl}" />
 		</jsp:include>
 	</td></tr>
 </tfoot>
 
 </table>
 </c:otherwise>
 </c:choose>
  </fieldset>
  
  
<script type="text/javascript">
		$(document).ready(function() {
			$('.searchCriteria').hide();
		});
</script>